/***
 * 资源执行list
 */
var ResRunList = new Pearlsen.BaseList({
	gridId:'auditStepGrid',
	advSearchId:'advSearchWin',
	module:'资源执行',
	modulePath:'/pages/rms/resrun/',
	moduleName:'ResRun',
	idProperty:'stepId',
	nameProperty:'resName',
	dataSetHandler:'ResRunDataSetHandler',
	queryHandler:'ResRunQueryHandler',
	renderStepStatus:function(value){
		var color=['green','orange','green','orange','green','red'];
		var arr=['新建','待审批','未处理','已处理','已完成,审批通过','已完成,审批拒绝'];
		try{
			var intIndex = parseInt(value);
			return '<span style=\'color:'+color[intIndex]+';\'>'+arr[intIndex]+'</span>';
		}catch(e){
		}
        return "";
	},
	deal:function(){
		var record = this.getSelectedOne();
		if(record ){
			var stepstatus = record.data['stepstatus'];
			if( stepstatus == '3' ){
    			Pearlsen.Utils.showInfoMsg("该任务已经处理,不能重复处理");
			}else{
				var objId = record.data[this.idProperty];
				var objName = record.data[this.nameProperty];
				var applyId = record.data["applyId"];
				var url = this.modulePath +"dealResRun.jsp?objId={0}&objName={1}&applyId={2}";
				url = url.format(objId,objName,applyId);
				var tabId = this.createTabId("add");
				parent.MainTab.addTab(tabId,"资源执行",url);
			}
		}
	},
	view:function(){
		var record = this.getSelectedOne();
		if(record ){
			var objId = record.data[this.idProperty];
			var objName = record.data[this.nameProperty];
			var applyId = record.data["applyId"];
			var url = this.modulePath +"viewResRun.jsp?objId={0}&objName={1}&applyId={2}";
			url = url.format(objId,objName,applyId);
			var tabId = this.createTabId("add");
			parent.MainTab.addTab(tabId,"资源执行查看",url);
		}
	}
});
